<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 transitional//EN">
<html>
<head>
  <title>Filter Criteria Element</title>


  <link rel="stylesheet" href="../style/style.css" type="text/css">

  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>


<body>

<h1>FilterConditionElement</h1>

<p>Defines a fileter criteria.</p>

<h3>Description</h3>

<p>The filter criteria defines a filter to apply to a List,
Table, Group or other element. Expressions are of the form "expression
op value" or "expression op value 1, value 2". A special case is
"expression is true" in which the expression itself is a Boolean
expression.</p>

<p>The simplest expression is comparison with a column in the
data row:</p>

<pre class="code-block">row.State = "CA"</pre>

<p>A slightly more complex comparison is to use a report
parameter:</p>

<pre class="code-block">row.State = params.StateParam</pre>

<p>Some conditions may require conditional logic:</p>

<pre class="code-block">( row.Balance &lt; 0 || row.Status = "Suspended" ) <i>is true</i></pre>

<p>Note that the "is true" is present just to say that the entire
expression should, itself, be treated as a complete condition.</p>

<p>Ranking expressions let the report choose only the most
interesting rows:</p>

<pre class="code-block">row.Balance Top 10</pre>

<p>Which means to display the ten customers with the highest
balances.</p>

<p>When used with groups, a filter can refer to total computed
over the group:</p>

<pre class="code-block">Total.sum( row.InvoiceAmt ) &gt; 1000</pre>

<p>The filter can also refer to totals computed over the entire
data set, or a higher level group. To display only customers whose
sales account for at least 5% of total sales:</p>

<pre class="code-block">Total.sum( row.InvoiceAmt ) &gt;= Total.sum_overall( row.InvoiceAmt ) * 0.05</pre>

<h3>See Also</h3>

<h2 class="property">expr</h2>

<p>The name of a data row column or an aggregate expression.</p>

<h3>Description</h3>

<p>The filter expression is the name of a data row column or an
aggregate expression. A filter only makes sense when computed using a
data row column. BIRT accepts a value such as 1 or "hello, world", but
then the same filter criteria will be applied to every row. Such
behavior may be useful when testing, but seldom in a production report.</p>

<h3>See Also</h3>

<h2 class="property">operator</h2>

<p>The operator to apply to the expression.</p>

<h3>Choices</h3>

<ul>

  <li>lt: Relational operator.</li>

  <li>le: Relational operator.</li>

  <li>eq: Relational operator.</li>

  <li>ne: Relational operator.</li>

  <li>ge: Relational operator.</li>

  <li>gt: Relational operator.</li>

  <li>is-null: Checks if the value is null.</li>

  <li>is-not-null: Checks if the value is not null.</li>

  <li>between: Checks if a value is between two values.</li>

  <li>not-between: Checks if a value is not between two values.</li>

  <li>is-true: Checks a Boolean condition. Use these if the
expression condition itself already expresses the full filter condition.</li>

  <li>is-false: Checks if a Boolean condition is false.</li>

  <li>like: Check the value of a column against a JavaScript
regular expression.</li>

  <li>top-n: Accept the value only if it is within the top <i>n
    </i>values.</li>

  <li>bottom-n: Accept the value only if it is within the bottom <i>n
    </i>values.</li>

  <li>top-percent: Accept the value only if it is within the top
percentage of values.</li>

  <li>bottom-percent: Accept the value only if it is within the
bottom percentage<i> </i>of values.</li>

</ul>

<h3>Description</h3>

<p>A filter criteria is of the form:</p>

<pre class="code-block">expr op value1 (value2)</pre>

<p>The operator says how to test the expression. It can be a
simple relational operator:</p>

<pre class="code-block">expr = 10</pre>

<p>Or one of the other operations shown above.</p>

<p>The ranking operators (Top N, Bottom N, Top Percent and Bottom
Percent) can include ties. For example, suppose we want the top three
customers by sales. Suppose we have the following customers and sales:</p>

<ul>

  <li>A, 100</li>

  <li>B, 200</li>

  <li>C, 300</li>

  <li>D, 100</li>

  <li>E, 50</li>

  <li>F, 0</li>

</ul>

<p>A top-3 ranking would include customers C, B, A and D because
A and D both have the same sales amount.</p>

<h3>See Also</h3>

<h2 class="property">value1</h2>

<p>The first (or only) operand.</p>

<h3>Description</h3>

<p>The value for simple conditions with the operators: &lt;,
&lt;=, =, &lt;&gt;, &gt;=, &gt;, between, not
between, like. Gives the "N" for the top N, Bottom N conditions. Gives
the "percent" for the Top Percent and Bottom Percent conditions.</p>

<p>The <code>value1</code> property for a ranking
operator must be constant with respect to the data set. For example, it
can reference a report parameter, but not (normally) a column. The
result is undefined when used with a value that varies within the data
set.</p>

<table class="section-table">

  <thead><tr>

    <td>Operator</td>

    <td>Value 1</td>

  </tr>

  </thead> <tbody>

    <tr>

      <td>&lt;, &lt;=, =, &lt;&gt;, &gt;=,
&gt;</td>

      <td>X</td>

    </tr>

    <tr>

      <td>is null,<br>

is not null</td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td>between, not between</td>

      <td>X<br>

(lower bound)</td>

    </tr>

    <tr>

      <td>is true,<br>

is false</td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td>like</td>

      <td>X<br>

(the regular expression)</td>

    </tr>

    <tr>

      <td>any</td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td>top N,<br>

bottom N</td>

      <td>X<br>

(the n value)</td>

    </tr>

    <tr>

      <td>top percent, bottom percent</td>

      <td>X<br>

(the % value)</td>

    </tr>

  </tbody>
</table>

<h3>See Also</h3>

<h2 class="property">value2</h2>

<p>The second operator for between &amp; not between
operators.</p>

<h3>Description</h3>

<p>The value for conditions with the operators between and not
between. Gives the upper value of the range.</p>

<table class="section-table">

  <thead><tr>

    <td>Operator</td>

    <td>Value 2</td>

  </tr>

  </thead> <tbody>

    <tr>

      <td>&lt;, &lt;=, =, &lt;&gt;, &gt;=,
&gt;</td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td>is null,<br>

is not null</td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td>between, not between</td>

      <td>X<br>

(upper bound)</td>

    </tr>

    <tr>

      <td>is true,<br>

is false</td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td>like</td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td>any</td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td>top N,<br>

bottom N</td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td>top percent, bottom percent</td>

      <td>&nbsp;</td>

    </tr>

  </tbody>
</table>

<h3>See Also</h3>

</body>
</html>
